//
//  AppDelegate.m
//  Demo@
//
//  Created by 闫潇 on 14-8-20.
//  Copyright (c) 2014年 xian. All rights reserved.
//

#import "AppDelegate.h"

@implementation AppDelegate
//应用将要加载完成
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //1.初始化视口
    //CGRect    矩形结构体
    //CGPoint   起始点
    //CGSize    宽高
    self.window = [[UIWindow alloc]initWithFrame: [[UIScreen mainScreen] bounds]];
    
    //3.设置window为主窗口，并令其显示到手机上
    [self.window makeKeyAndVisible];
    
    [self.window setBackgroundColor:[UIColor colorWithRed:133/255.0 green:133/255.0 blue:133/255.0 alpha:1]];
    //UIButton
    //frame 框架，用于存储位置和大小
    UIButton * b1 = [[UIButton alloc]initWithFrame:CGRectMake(20, 20, 100, 100)];
    [b1 setBackgroundColor:[UIColor redColor]];
    //将b1作为子视图添加到window中
    [self.window addSubview:b1];
    
    
    [b1 addTarget:self action:@selector(doButton) forControlEvents:UIControlEventTouchUpInside];
    
    [b1 setTitle:@"确认" forState:UIControlStateNormal];
    [b1 setTitle:@"不确认" forState:UIControlStateHighlighted];
    UILabel * l = [[UILabel alloc]initWithFrame:CGRectMake(100, 200, 120, 40)];
    //设置文本
    [l setText:@"南方姑娘"];
    //设置颜色
    [l setBackgroundColor:[UIColor blueColor]];
    //设置对齐方式
    [l setTextAlignment:NSTextAlignmentCenter];
    
    [l setTextColor:[UIColor yellowColor]];
    [l setFont: [UIFont italicSystemFontOfSize:20]];
    [self.window addSubview:l];
    /*
     Button 的事件监听机制
     监听者     刘翔
     执行者     刘翔
     执行动作   起跑
     被监听对象  裁判的对象
     
     
     监听者        b1
     被鉴定听者     b1
     监听事件      UIcontrolEvents
     执行者        target
     执行的方法    action
    */
    
//    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//    // Override point for customization after application launch.
//    self.window.backgroundColor = [UIColor whiteColor];
//    [self.window makeKeyAndVisible];

    NSArray * fontFamilies = [UIFont familyNames];
    [fontFamilies enumerateObjectsUsingBlock:^(UIFont * obj,NSUInteger idx,BOOL * stop)
     {
         NSLog(@"%@",obj);
         NSLog(@"%@",[UIFont ])
     }
    
    
    return YES;
//    -(void)doButton
//    {
//        NSLog(@"我点");
//    }
}



@end
